package org.coderjonny.dto;

import lombok.Data;
import org.coderjonny.trace.TraceIdUtil;

import javax.validation.constraints.NotNull;

@Data
public class Request<T> {
    private String traceId;
    @NotNull(message = "data不能为空")
    private T data;
    public static <T> Request<T> buildInner(T data){
        Request<T> request = new Request<>();
        String nowTraceId = TraceIdUtil.getNowTraceId();
        request.setData(data);
        request.setTraceId(nowTraceId);
        return request;
    }
}
